import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:recipe/favorate.dart';
import 'package:recipe/module/globalColor.dart';

import 'home.dart';

void main() {
  runApp(
    MyApp(),
  );
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '厨神在家',
      theme: ThemeData(
        brightness: Brightness.light,
        primaryColor: GlobalColor.themeColor,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _currentIndex = 0;
  List<Widget> pages = [HomePage(), Favorate()];
  // final _bottomNavigationColor = Colors.blue;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: FlutterEasyLoading(child: pages[_currentIndex]),
        bottomNavigationBar: BottomNavigationBar(
            items: [
              BottomNavigationBarItem(
                  icon: Icon(
                    Icons.home,
                    // color: _bottomNavigationColor,
                  ),
                  title: Text(
                    '首页',
                    // style: TextStyle(color: _bottomNavigationColor),
                  )),
              BottomNavigationBarItem(
                  icon: Icon(
                    Icons.stars,
                    // color: _bottomNavigationColor,
                  ),
                  title: Text(
                    '我的收藏',
                    // style: TextStyle(color: _bottomNavigationColor),
                  )),
            ],
            currentIndex: _currentIndex,
            onTap: (int index) {
              setState(() {
                _currentIndex = index;
              });
            }));
  }
}
